home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / hard / galer / source / src.lha / Source / GALer / GALer.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-10  |  29.6 KB  |  1,296 lines

  1. /****************************************************************/
  2. /*                                */
  3. /* GALer-Software                        */
  4. /*                                */
  5. /* Soft- and Hardware is copyright (c) 1991-1993        */
  6. /* by Christian Habermann                    */
  7. /*    Asamstr. 17                        */
  8. /*    85356 Freising                        */
  9. /*    Germany                            */
  10. /*                                */
  11. /* All rights reserved.                        */
  12. /*                                */
  13. /* This is Version 1.5 of GALer.                */
  14. /*                                */
  15. /* used Compiler: SAS-C 6.3                    */
  16. /*                                 */
  17. /****************************************************************/
  18.  
  19.  
  20. #define  STRINGARRAY    1
  21.  
  22. #include <devices/parallel.h>
  23. #include <exec/io.h>
  24. #include <exec/memory.h>
  25. #include <exec/ports.h>
  26. #include <exec/types.h>
  27. #include <graphics/gfxbase.h>
  28. #include <graphics/text.h>
  29. #include <graphics/displayinfo.h>
  30. #include <intuition/intuition.h>
  31. #include <libraries/dosextens.h>
  32. #include <libraries/reqtools.h>
  33. #include <libraries/locale.h>
  34. #include <libraries/gadtools.h>
  35. #include <stdlib.h>
  36.  
  37. #include <clib/alib_protos.h>
  38. #include <proto/locale.h>
  39. #include <proto/reqtools.h>
  40. #include <proto/intuition.h>
  41. #include <proto/exec.h>
  42. #include <proto/gadtools.h>
  43.  
  44.  
  45. #include "GALer.h"
  46. #include "Localize.h"
  47.  
  48.  
  49.  
  50. #define        Menu_1        0
  51. #define        Menu_2        1
  52. #define        Menu_3        2
  53. #define        Menu_4        3
  54. #define        Menu_5        4
  55. #define        Menu_6        5
  56.  
  57. #define        Item_1        0
  58. #define        Item_2        1
  59. #define        Item_3        2
  60. #define        Item_4        3
  61. #define        Item_5        4
  62. #define        Item_6        5
  63. #define        Item_7        6
  64. #define        Item_8        7
  65. #define        Item_9        8
  66. #define        Item_10        9
  67.  
  68. #define        SubItem_1    0
  69. #define        SubItem_2    1
  70. #define        SubItem_3    2
  71. #define        SubItem_4    3
  72.  
  73.  
  74.  
  75. #define AsmGad_CNT     8
  76. #define WriteGad_CNT     6
  77. #define    JEDGad_CNT     4
  78. #define RAsm16_CNT    24
  79. #define RAsm20_CNT    28
  80. #define OptGad_CNT     2
  81. #define SelEd_CNT     3
  82.  
  83.  
  84. #ifdef LATTICE
  85. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  86. int chkabort(void) { return(0); }  /* really */
  87. #endif
  88.  
  89.  
  90.  
  91.  
  92. extern    struct    ReqFileRequester    MyFileReqStruct;
  93.  
  94. extern    struct    NewGadget WriteNGad[], JEDNGad[], AsmNGad[], OptNGad[];
  95. extern    struct    NewGadget RAsm16NGad[], RAsm20NGad[], SelectEditorNGad[];
  96.  
  97. extern    UWORD    WriteGTypes[], JEDGTypes[], AsmGTypes[], OptGTypes[];
  98. extern    UWORD    RAsm16GTypes[], RAsm20GTypes[], SelectEditorGTypes[];
  99.  
  100. extern    ULONG    WriteGTags[], JEDGTags[], AsmGTags[], OptGTags[];
  101. extern    ULONG    RAsm16GTags[], RAsm20GTags[], SelectEditorGTags[];
  102.  
  103.  
  104.  
  105.  
  106. struct    IORequest    *CreateExtIO();
  107. struct    IntuitionBase    *IntuitionBase = 0;
  108. struct    GfxBase        *GfxBase = 0;
  109. struct    LocaleBase    *LocaleBase = 0;
  110. struct    ReqToolsBase    *ReqToolsBase = 0;
  111. struct  Library        *GadToolsBase = 0;
  112. struct    IntuiMessage    *message;
  113. struct    Screen        *screen;
  114. struct    Window        *window,*old_ReqWin;
  115. struct    MsgPort        *timeport, *parport;
  116. struct    timerequest    *timereq;
  117. struct    IOExtPar    *parreq;
  118. struct    Menu        *mainmenu, *pruefermenu;
  119. struct    rtFileRequester    *filereq;
  120. struct    Gadget        *WriteGList, *JEDGList, *AsmGList, *OptGList;
  121. struct    Gadget        *RAsm16GList, *RAsm20GList, *SelectEditorGList;
  122. struct  Gadget        *SelectEditorGadgets[SelEd_CNT];
  123.  
  124.  
  125.  
  126. struct    Catalog        *catalog = 0;
  127.  
  128. APTR    VisualInfo;
  129.  
  130.  
  131.  
  132. struct TextAttr topaz8 = { (STRPTR)"topaz.font", 8, 0x00, 0x01};
  133.  
  134.  
  135.  
  136. UBYTE  title[] = "GALer V1.5  © 1993 by Christian Habermann                  GAL16V8   ";
  137.  
  138.  
  139.  
  140.  
  141. struct NewMenu MainNewMenu[] = {
  142.     /* Project menu */
  143.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  144.     NM_ITEM,  NULL, NULL, 0, 0L,   NULL,
  145.     NM_ITEM,  NULL, NULL, 0, NULL, NULL,
  146.     NM_SUB, (STRPTR)"V1.0, V1.1", NULL, CHECKIT, 6L, NULL,
  147.     NM_SUB, (STRPTR)"V1.2", NULL, CHECKIT, 5L, NULL,
  148.     NM_SUB, (STRPTR)"V1.3", NULL, CHECKIT, 3L, NULL,
  149.     NM_ITEM,  NULL, NULL, 0, 0L,   NULL,
  150.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  151.     NM_ITEM,  NULL, NULL, 0, 0L,   NULL,
  152.  
  153.     /* GAL-Type menu */
  154.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  155.     NM_ITEM,  NULL, NULL, CHECKIT, 14L, NULL,
  156.     NM_ITEM,  NULL, NULL, CHECKIT, 13L, NULL,
  157.     NM_ITEM,  NULL, NULL, CHECKIT, 11L, NULL,
  158.     NM_ITEM,  NULL, NULL, CHECKIT,  7L, NULL,
  159.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  160.     NM_ITEM,  NULL, NULL, CHECKIT|MENUTOGGLE, 0L, NULL,
  161.  
  162.     /* GAL menu */
  163.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  164.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  165.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  166.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  167.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  168.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  169.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  170.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  171.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  172.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  173.  
  174.     /* GAL-Assembler menu */
  175.     NM_TITLE, NULL,    NULL, 0, NULL, NULL,
  176.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  177.  
  178.     /* GAL-Disassembler menu */
  179.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  180.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  181.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  182.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  183.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  184.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  185.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  186.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  187.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  188.  
  189.     /* Tools menu */
  190.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  191.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  192.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  193.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  194.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  195.     NM_ITEM,  NULL,    NULL, 0, 0L, NULL,
  196.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  197.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  198.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  199.     NM_ITEM,  (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  200.     NM_ITEM,  NULL, NULL, 0, 0L, NULL,
  201.     NM_END,   NULL, NULL, 0, 0L, NULL };
  202.  
  203.  
  204.  
  205. struct NewMenu PrueferNewMenu[] = {
  206.     NM_TITLE, NULL, NULL, 0, NULL, NULL,
  207.     NM_ITEM,  NULL, NULL, 0, 0L,   NULL,
  208.     NM_END,   NULL, NULL, 0, 0L, NULL };
  209.  
  210.  
  211.  
  212. struct ColorSpec ScreenColors[] = { 0, 0x0A, 0x0A, 0x0A,
  213.                     1, 0x00, 0x00, 0x00,
  214.                     2, 0x0F, 0x0F, 0x0F,
  215.                     3, 0x06, 0x08, 0x0B,
  216.                    ~0, 0x00, 0x00, 0x00 };
  217.  
  218.  
  219. UWORD DriPens[] = { 0xFFFF };
  220.  
  221.  
  222.  
  223.  
  224.  
  225. SHORT  BorderVectors1[]  = {0,0,17,0,17,9,0,9,0,0};
  226. struct Border    Border1 = {-1,-1,2,3,JAM1,5,BorderVectors1,NULL};
  227. struct Border    Border2 = {-1,-1,3,3,JAM1,5,BorderVectors1,NULL};
  228.  
  229.  
  230. struct IntuiText IText39 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  231. struct IntuiText IText38 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  232. struct IntuiText IText37 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  233. struct IntuiText IText36 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  234. struct IntuiText IText35 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  235. struct IntuiText IText34 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  236. struct IntuiText IText33 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  237. struct IntuiText IText32 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  238. struct IntuiText IText31 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  239. struct IntuiText IText30 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
  240.  
  241.  
  242. struct IntuiText IText23 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  243. struct IntuiText IText22 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  244. struct IntuiText IText21 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  245. struct IntuiText IText20 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  246. struct IntuiText IText19 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  247. struct IntuiText IText18 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  248. struct IntuiText IText17 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  249. struct IntuiText IText16 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  250. struct IntuiText IText15 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  251. struct IntuiText IText14 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  252. struct IntuiText IText13 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  253. struct IntuiText IText11 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  254. struct IntuiText IText10 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  255. struct IntuiText IText9  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  256. struct IntuiText IText8  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  257. struct IntuiText IText7  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  258. struct IntuiText IText6  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  259. struct IntuiText IText5  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  260. struct IntuiText IText4  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  261. struct IntuiText IText3  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  262. struct IntuiText IText2  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  263. struct IntuiText IText1  = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
  264.  
  265.  
  266.  
  267. /* The gadgets for the symbolic GAL consist of several gadget lists.
  268. ** It depends on the GAL-type which gadget lists are used.
  269. ** Gadget numbers and gadget IDs less or equal 23 correspond with
  270. ** the pins of the GAL socket.
  271. ** The gadget lists are: Gadget23,22,2,1
  272. **             Gadget3,..,21 (without 12)
  273. **             Gadget30,..,37
  274. **             Gadget38
  275. **             Gadget39
  276. ** used gadgets:
  277. **
  278. ** GAL16V8:   level gadgets Gadget3,..,21 and IO-select gadgets30,..,37
  279. ** GAL20V8:   level gadgets Gadget3,..,21, Gadget23,22,2,1 and IO-select
  280. **            gadgets Gadget31,..37, Gadget38
  281. ** GAL22V10,  level gadgets Gadget3,..,21, Gadget23,22,2,1 and IO-select
  282. **          gadgets Gadget30,..37, Gadget38, Gadget39
  283. ** GAL20RA10:
  284. */ 
  285.  
  286.                     /* gadgets for the symbolic GAL */
  287.  
  288. struct Gadget    Gadget39 = {NULL,340,30,16,8,NULL,
  289.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  290.                  (APTR)&Border1,NULL,&IText39,NULL,NULL,39,NULL};
  291.  
  292.  
  293. struct Gadget    Gadget38 = {NULL,340,40,16,8,NULL,
  294.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  295.                  (APTR)&Border1,NULL,&IText38,NULL,NULL,38,NULL};
  296.  
  297.  
  298.  
  299. struct Gadget    Gadget37 = {NULL,340,50,16,8,NULL,
  300.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  301.                  (APTR)&Border1,NULL,&IText37,NULL,NULL,37,NULL};
  302.  
  303. struct Gadget    Gadget36 = {&Gadget37,340,60,16,8,NULL,
  304.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  305.                  (APTR)&Border1,NULL,&IText36,NULL,NULL,36,NULL};
  306.  
  307. struct Gadget    Gadget35 = {&Gadget36,340,70,16,8,NULL,
  308.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  309.                  (APTR)&Border1,NULL,&IText35,NULL,NULL,35,NULL};
  310.  
  311. struct Gadget    Gadget34 = {&Gadget35,340,80,16,8,NULL,
  312.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  313.                  (APTR)&Border1,NULL,&IText34,NULL,NULL,34,NULL};
  314.  
  315. struct Gadget    Gadget33 = {&Gadget34,340,90,16,8,NULL,
  316.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  317.                  (APTR)&Border1,NULL,&IText33,NULL,NULL,33,NULL};
  318.  
  319. struct Gadget    Gadget32 = {&Gadget33,340,100,16,8,NULL,
  320.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  321.                  (APTR)&Border1,NULL,&IText32,NULL,NULL,32,NULL};
  322.  
  323. struct Gadget    Gadget31 = {&Gadget32,340,110,16,8,NULL,
  324.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  325.                  (APTR)&Border1,NULL,&IText31,NULL,NULL,31,NULL};
  326.  
  327. struct Gadget    Gadget30 = {&Gadget31,340,120,16,8,NULL,
  328.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  329.                  (APTR)&Border1,NULL,&IText30,NULL,NULL,30,NULL};
  330.  
  331.  
  332.  
  333. struct Gadget    Gadget21 = {NULL,382,50,16,8,NULL,
  334.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  335.                  (APTR)&Border2,NULL,&IText21,NULL,NULL,21,NULL};
  336.  
  337. struct Gadget    Gadget20 = {&Gadget21,382,60,16,8,NULL,
  338.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  339.                  (APTR)&Border2,NULL,&IText20,NULL,NULL,20,NULL};
  340.  
  341. struct Gadget    Gadget19 = {&Gadget20,382,70,16,8,NULL,
  342.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  343.                  (APTR)&Border2,NULL,&IText19,NULL,NULL,19,NULL};
  344.  
  345. struct Gadget    Gadget18 = {&Gadget19,382,80,16,8,NULL,
  346.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  347.                  (APTR)&Border2,NULL,&IText18,NULL,NULL,18,NULL};
  348.  
  349. struct Gadget    Gadget17 = {&Gadget18,382,90,16,8,NULL,
  350.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  351.                  (APTR)&Border2,NULL,&IText17,NULL,NULL,17,NULL};
  352.  
  353. struct Gadget    Gadget16 = {&Gadget17,382,100,16,8,NULL,
  354.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  355.                  (APTR)&Border2,NULL,&IText16,NULL,NULL,16,NULL};
  356.  
  357. struct Gadget    Gadget15 = {&Gadget16,382,110,16,8,NULL,
  358.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  359.                  (APTR)&Border2,NULL,&IText15,NULL,NULL,15,NULL};
  360.  
  361. struct Gadget    Gadget14 = {&Gadget15,382,120,16,8,NULL,
  362.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  363.                  (APTR)&Border2,NULL,&IText14,NULL,NULL,14,NULL};
  364.  
  365. struct Gadget    Gadget13 = {&Gadget14,382,130,16,8,NULL,
  366.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  367.                  (APTR)&Border1,NULL,&IText13,NULL,NULL,13,NULL};
  368.  
  369. struct Gadget    Gadget11 = {&Gadget13,242,120,16,8,NULL,
  370.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  371.                  (APTR)&Border1,NULL,&IText11,NULL,NULL,11,NULL};
  372.  
  373. struct Gadget    Gadget10 = {&Gadget11,242,110,16,8,NULL,
  374.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  375.                  (APTR)&Border1,NULL,&IText10,NULL,NULL,10,NULL};
  376.  
  377. struct Gadget    Gadget9 = {&Gadget10,242,100,16,8,NULL,
  378.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  379.                  (APTR)&Border1,NULL,&IText9,NULL,NULL,9,NULL};
  380.  
  381. struct Gadget    Gadget8  = {&Gadget9,242,90,16,8,NULL,
  382.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  383.                  (APTR)&Border1,NULL,&IText8,NULL,NULL,8,NULL};
  384.  
  385. struct Gadget    Gadget7  = {&Gadget8,242,80,16,8,NULL,
  386.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  387.                  (APTR)&Border1,NULL,&IText7,NULL,NULL,7,NULL};
  388.  
  389. struct Gadget    Gadget6  = {&Gadget7,242,70,16,8,NULL,
  390.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  391.                  (APTR)&Border1,NULL,&IText6,NULL,NULL,6,NULL};
  392.  
  393. struct Gadget    Gadget5  = {&Gadget6,242,60,16,8,NULL,
  394.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  395.                  (APTR)&Border1,NULL,&IText5,NULL,NULL,5,NULL};
  396.  
  397. struct Gadget    Gadget4  = {&Gadget5,242,50,16,8,NULL,
  398.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  399.                  (APTR)&Border1,NULL,&IText4,NULL,NULL,4,NULL};
  400.  
  401. struct Gadget    Gadget3  = {&Gadget4,242,40,16,8,NULL,
  402.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  403.                  (APTR)&Border1,NULL,&IText3,NULL,NULL,3,NULL};
  404.  
  405.  
  406.  
  407.  
  408. struct Gadget    Gadget1  = {NULL,242,20,16,8,NULL,
  409.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  410.                  (APTR)&Border1,NULL,&IText1,NULL,NULL,1,NULL};
  411.  
  412. struct Gadget    Gadget2  = {&Gadget1,242,30,16,8,NULL,
  413.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  414.                  (APTR)&Border1,NULL,&IText2,NULL,NULL,2,NULL};
  415.  
  416. struct Gadget    Gadget23 = {&Gadget2,382,30,16,8,NULL,
  417.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  418.                  (APTR)&Border1,NULL,&IText23,NULL,NULL,23,NULL};
  419.  
  420. struct Gadget    Gadget22 = {&Gadget23,382,40,16,8,NULL,
  421.                  GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
  422.                  (APTR)&Border1,NULL,&IText22,NULL,NULL,22,NULL};
  423.  
  424.  
  425.  
  426.  
  427.  
  428. struct    Process        *myproc;
  429.  
  430. struct    RastPort    *rp;
  431. struct    ViewPort    *vp;
  432.  
  433. int    pruef_mode;
  434.  
  435. long    monitorID;
  436.  
  437.  
  438. extern     int    GALType, MaxFuseAdr, SigAdr, hw_version;
  439.  
  440. extern    struct    Configuration    Config;
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447. void main(void)
  448. {
  449. ULONG    class;
  450. USHORT    code,     gadID;
  451. struct    Gadget     *gad;
  452. struct  MenuItem *menuitem;
  453.  
  454.  
  455.  
  456.  
  457.  OpenStuff();                    /*Libs, Windows... öffnen*/
  458.  
  459.  
  460.  rp = window->RPort;             /* RastPort- und Viewport-Zeiger */
  461.  vp = &screen->ViewPort;         /* initialisieren */
  462.  
  463.  
  464.                     /* Graphik an PAL/NTSC anpfassen */
  465.  if (monitorID == PAL_MONITOR_ID)     /* PAL ?*/
  466.    DrawBevelBox(rp, 5L, 190L, 630L, 55L, GTBB_Recessed, TRUE, GT_VisualInfo, VisualInfo, TAG_DONE);
  467.  
  468.  DrawBevelBox(rp, 28L, 150L, 584L, 35L, GTBB_Recessed, TRUE, GT_VisualInfo, VisualInfo, TAG_DONE);
  469.  
  470.  
  471.  
  472.  if (GetParPort()) {                /*Druckerport frei?*/
  473.    puts((char *)AppStrings[MSG_ERR_PARPORT].as_Str);
  474.    CloseStuff();
  475.    exit(0);
  476.   }
  477.  
  478.  if (GetTimer()) {                /*Timer holen*/
  479.    FreeParPort();
  480.    puts((char *)AppStrings[MSG_ERR_TIMER].as_Str);
  481.    CloseStuff();
  482.    exit(0);    
  483.   }
  484.  
  485.  
  486.  InitGALer();                    /*Ausgänge von IC3,4,5 auf*/
  487.  EnableOutput();                /*LOW schalten*/
  488.  
  489.  LoadConfig();                    /* Voreinstellung laden */
  490.  
  491.  
  492.  
  493.     /* GadTools-Gadgets erstellen */
  494.  
  495.  if (InitMyGadgets()) {
  496.    puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
  497.    CloseStuff();
  498.    FreeTimer();
  499.    FreeParPort();
  500.    exit(0);
  501.  }
  502.  
  503.  
  504.  
  505.  
  506.  for (;;)  {
  507.    Wait(1L << window->UserPort->mp_SigBit);
  508.    while (message = (struct IntuiMessage *)GetMsg(window->UserPort)) {
  509.  
  510.      class = message->Class;
  511.      code  = message->Code;
  512.  
  513.      if (class == GADGETUP) {
  514.        gad   = (struct Gadget *)message->IAddress;
  515.        gadID = gad->GadgetID;
  516.      }
  517.  
  518.      ReplyMsg((struct Message *)message);
  519.  
  520.      switch (class) {
  521.  
  522.     case MENUHELP:
  523.  
  524.         if (pruef_mode == ON)
  525.           HelpOnCheckerMenu(code);
  526.         else
  527.           HelpOnMainMenu(code);
  528.  
  529.         break;        
  530.  
  531.  
  532.     case MENUPICK:
  533.  
  534.         while (code != MENUNULL) {
  535.           if (pruef_mode != ON)
  536.             menuitem = ItemAddress(mainmenu, (ULONG)code);
  537.           else
  538.             menuitem = ItemAddress(pruefermenu, (ULONG)code);
  539.  
  540.  
  541.           if (MENUNUM(code) != MENUNULL)
  542.             ExecuteMenu(MENUNUM(code), ITEMNUM(code), SUBNUM(code));
  543.  
  544.           code = menuitem -> NextSelect;
  545.         }
  546.  
  547.         break;
  548.  
  549.  
  550.     case GADGETUP:
  551.  
  552.         if ((gadID < 100) && (pruef_mode == ON))
  553.           Pruefer(gad, gadID);
  554.  
  555.         break;
  556.  
  557.  
  558.     case RAWKEY:
  559.  
  560.         if (code == 0x5F)        /* Help key? */
  561.           Help();
  562.  
  563.         break;
  564.  
  565.       }
  566.     }
  567.   }
  568.  
  569. }     /*end of main*/
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  577. /*                Subroutinen                */
  578. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  579.  
  580.  
  581. /*aufgerufenes Menü ausführen*/
  582. void ExecuteMenu(int menu, int item, int subitem)
  583. {
  584.  
  585.  if (pruef_mode == ON) {
  586.    if ((menu == Menu_1) && (item == Item_1))
  587.      TogglePruefer();
  588.  }
  589.  else {
  590.  
  591.    switch (menu) {
  592.  
  593.      case Menu_1:                /* Projekt */
  594.  
  595.        switch (item) {
  596.  
  597.      case Item_1:                    /* About */
  598.        About();
  599.        break;
  600.  
  601.      case Item_2:                    /* Hardware-Version */
  602.        switch (subitem) {
  603.  
  604.          case SubItem_1:
  605.            hw_version = HW_GALER_1_0;
  606.            break;
  607.  
  608.          case SubItem_2:
  609.            hw_version = HW_GALER_1_2;
  610.            break;
  611.  
  612.          case SubItem_3:
  613.            hw_version = HW_GALER_1_3;
  614.            break;
  615.  
  616.        }
  617.                             /* set 22V10  and */
  618.        if (hw_version <= HW_GALER_1_2) {        /* and 20RA10 menu */
  619.          OffMenu(window, FULLMENUNUM(1, 2, 0));
  620.          OffMenu(window, FULLMENUNUM(1, 3, 0));
  621.  
  622.          if (GALType == GAL22V10 || GALType == GAL20RA10)
  623.            SetGALType(GAL16V8);
  624.  
  625.        }
  626.        else {
  627.          OnMenu(window, FULLMENUNUM(1, 2, 0));
  628.          OnMenu(window, FULLMENUNUM(1, 3, 0));
  629.        }
  630.  
  631.        Config.HardwareVersion = hw_version;
  632.        InitGALer();
  633.        break;
  634.  
  635.      case Item_3:                    /* Save Config. */
  636.        SaveConfig();
  637.        break;
  638.  
  639.      case Item_5:                    /* Quit */
  640.        CloseStuff();
  641.        FreeTimer();
  642.        FreeParPort();
  643.        exit(0);
  644.        break;
  645.  
  646.     }
  647.        break;
  648.  
  649.      case Menu_2:                /* GAL-Typ */
  650.  
  651.        switch (item) {
  652.  
  653.      case Item_1:
  654.         SetGALType(GAL16V8);
  655.         break;
  656.  
  657.      case Item_2:
  658.         SetGALType(GAL20V8);
  659.         break;
  660.  
  661.      case Item_3:
  662.         SetGALType(GAL22V10);
  663.         break;
  664.  
  665.      case Item_4:
  666.         SetGALType(GAL20RA10);
  667.         break;
  668.  
  669.      case Item_6:                    /* Requester */
  670.         Config.GALTypeReq = !Config.GALTypeReq;
  671.         break;
  672.  
  673.     }
  674.        break;
  675.  
  676.      case Menu_3:                /*GAL*/
  677.  
  678.        switch (item) {
  679.  
  680.      case Item_1:
  681.        ProgramGAL();                /*programmieren*/
  682.        break;
  683.  
  684.      case Item_2:                    /*kopieren*/
  685.        CopyGAL();
  686.        break;
  687.  
  688.      case Item_3:                    /*löschen*/
  689.        Loeschen();
  690.        break;
  691.  
  692.      case Item_4:                    /*vergleichen*/
  693.        Compare();
  694.        break;
  695.  
  696.      case Item_5:                    /*Leertest*/
  697.        Leertest();
  698.        break;
  699.  
  700.      case Item_6:                    /*setze Sec.*/
  701.        SetSecurity(YES);
  702.        break;
  703.  
  704.      case Item_7:
  705.        TestSecurity();                /*teste Sec.*/
  706.        break;
  707.  
  708.      case Item_9:
  709.        Schreibverhalten();
  710.        break;
  711.         }
  712.        break;
  713.  
  714.      case Menu_4:                    /*GAL-Assembler*/
  715.      if (item == Item_1) {
  716.        AssembleInputFile(ASSEMBLER);    /*Eingabe-Datei assemblieren*/
  717.        break;
  718.       }
  719.        break;
  720.  
  721.      case Menu_5:                    /*GAL-Disassembler*/
  722.  
  723.        switch (item) {
  724.  
  725.      case Item_1:
  726.        PrintSignature();
  727.        break;
  728.  
  729.      case Item_2:
  730.        PrintACW();
  731.        break;
  732.  
  733.      case Item_3:
  734.        GALInfo();
  735.        break;
  736.  
  737.      case Item_5:
  738.        PutJedec();
  739.        break;
  740.  
  741.      case Item_6:
  742.        JedecRequester();
  743.        break;
  744.  
  745.      case Item_8:
  746.        Reassembler();
  747.        break;
  748.     }
  749.        break;
  750.  
  751.      case Menu_6:                    /*Tools*/
  752.  
  753.        switch (item) {
  754.  
  755.      case Item_1:
  756.        PrintPinNames();
  757.        break;
  758.  
  759.      case Item_2:
  760.        ClearPinNames();
  761.        break;
  762.  
  763.      case Item_3:
  764.        TogglePruefer();
  765.        break;
  766.  
  767.      case Item_5:
  768.        Optimizer();
  769.        break;
  770.  
  771.      case Item_7:
  772.        SelectEditor();
  773.        break;
  774.  
  775.      case Item_8:
  776.        CallEditor();
  777.        break;
  778.  
  779.      case Item_10:
  780.        Help();
  781.        break;
  782.  
  783.        }
  784.    }
  785.  }   
  786. }
  787.  
  788.  
  789.  
  790.  
  791.  
  792. /* Parallel-Port belegen
  793. */
  794. int GetParPort(void)
  795. {
  796.  
  797.  parport = (struct MsgPort *)CreatePort(0L,0L);
  798.  if (parport == NULL)
  799.    return(-1);
  800.  
  801.  parreq = (struct IOExtPar *) CreateExtIO(parport,(long)sizeof(struct IOExtPar));
  802.  if (parreq == NULL) {
  803.    DeletePort(parport);
  804.    return(-1);
  805.   }
  806.  
  807.  if (OpenDevice((BYTE *)"parallel.device",0L,(struct IORequest *)parreq,0L)) {
  808.    DeleteExtIO((struct IORequest *)parreq);
  809.    DeletePort(parport);
  810.    return(-1);
  811.   }
  812.  
  813.  InitParPort();                /*Datenrichtungsregister der CIAs*/
  814.                     /*initialisieren*/
  815.  return(0);
  816. }
  817.  
  818.  
  819.  
  820.  
  821. /* Parallel-Port wieder freigeben
  822. */
  823. void FreeParPort(void)
  824. {
  825.  RestoreParPort();        /*Datenrichtungsregister der CIAs restau-*/
  826.                 /*rieren, nicht aber den Zustand der Aus-*/
  827.                 /*gänge, da sonst der angeschlossene Brenner*/
  828.                 /*einen ungewollten Befehl erhalten könnte*/
  829.                 /*(Vcc on, VEdit on,...).*/
  830.  CloseDevice((struct IORequest *)parreq);    /* Port wieder freigeben */
  831.  DeleteExtIO((struct IORequest *)parreq);
  832.  DeletePort(parport);
  833. }
  834.  
  835.  
  836.  
  837.  
  838.  
  839. /* Timer holen
  840. */
  841. int GetTimer(void)
  842. {
  843.  
  844.  timeport = (struct MsgPort *)CreatePort(0L,0L);
  845.  if (timeport == NULL)
  846.    return(-1);
  847.  
  848.  timereq=(struct timerequest *)AllocMem(
  849.             (long)sizeof(struct timerequest),MEMF_PUBLIC);
  850.  if (timereq == NULL) {
  851.    DeletePort(timeport);
  852.    return(-1);
  853.   }
  854.  
  855.  timereq->tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE;
  856.  timereq->tr_node.io_Message.mn_Node.ln_Pri = 0;
  857.  timereq->tr_node.io_Message.mn_ReplyPort = timeport;
  858.  
  859.  if (OpenDevice (TIMERNAME, UNIT_MICROHZ, (struct IORequest *)timereq, 0L)) {
  860.    FreeMem(&timereq, (long)sizeof(struct timerequest));
  861.    DeletePort (timeport);
  862.    return (-1);
  863.   }
  864.  
  865.  return(0);
  866. }
  867.  
  868.  
  869.  
  870.  
  871.  
  872. /* Timer-Device wieder freigeben
  873. */
  874. void FreeTimer(void)
  875. {
  876.   CloseDevice ((struct IORequest *)timereq);
  877.  
  878.   FreeMem (timereq, (long)sizeof(struct timerequest));
  879.  
  880.   DeletePort (timeport);
  881. }
  882.  
  883.  
  884.  
  885.  
  886.  
  887. /* 
  888. ** micro: microsec. to wait
  889. ** secs: seconds to wait
  890. */
  891. void WaitForTimer(ULONG micro)
  892. {
  893.  
  894.   timereq->tr_node.io_Command = TR_ADDREQUEST;
  895.   timereq->tr_time.tv_secs = 0;
  896.   timereq->tr_time.tv_micro = micro;
  897.  
  898.   DoIO ((struct IORequest *)timereq);
  899. }
  900.  
  901.  
  902.  
  903.  
  904.  
  905. /* Screen, Window, Libraries usw. öffnen
  906. */
  907. void OpenStuff(void)
  908. {
  909.  
  910. int scr_height, win_height;
  911.  
  912.  
  913.   if ((LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library", 38L)))
  914.     catalog = OpenCatalog(NULL, (STRPTR)"GALer.catalog", OC_Version, 1, TAG_DONE);
  915.  
  916.   LocalizeText();
  917.  
  918.  
  919.  
  920.   if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37L))) {
  921.     puts((char *)AppStrings[MSG_ERR_INTUITIONLIB].as_Str);
  922.     CloseStuff();
  923.     exit(0);
  924.   }
  925.  
  926.  
  927.   if (!(GadToolsBase = OpenLibrary("gadtools.library", 37L))) {
  928.     puts((char *)AppStrings[MSG_ERR_GADTOOLSLIB].as_Str);
  929.     CloseStuff();
  930.     exit(0);
  931.   }
  932.  
  933.  
  934.   if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 37L))) {
  935.     puts((char *)AppStrings[MSG_ERR_GRAPHICSLIB].as_Str);
  936.     CloseStuff();
  937.     exit(0);
  938.   }
  939.  
  940.  
  941.   if (!(ReqToolsBase = (struct ReqToolsBase *)OpenLibrary(REQTOOLSNAME, REQTOOLSVERSION))) {
  942.     puts((char *)AppStrings[MSG_ERR_REQTOOLSLIB].as_Str);
  943.     CloseStuff();
  944.     exit(0);
  945.   }
  946.  
  947.  
  948.   if (!(filereq = rtAllocRequestA(RT_FILEREQ, NULL))) {
  949.     puts((char *)AppStrings[MSG_ERR_FILEREQ].as_Str);
  950.     CloseStuff();
  951.     exit(0);
  952.   }
  953.  
  954.  
  955.                     /* Screen und Window an PAL/NTSC anpassen*/
  956.   if (GfxBase->DisplayFlags & NTSC) {
  957.     scr_height = 200;            /* NTSC */
  958.     win_height = 189;
  959.     monitorID  = NTSC_MONITOR_ID;
  960.   }
  961.   else {
  962.     scr_height = 256;            /* PAL */
  963.     win_height = 245;
  964.     monitorID  = PAL_MONITOR_ID;
  965.   }
  966.  
  967.  
  968.  
  969.   if (!(screen = OpenScreenTags( NULL, SA_Left,    0,
  970.                 SA_Top,        0,
  971.                 SA_Width,    640,
  972.                 SA_Height,    scr_height,
  973.                 SA_Depth,    2,
  974.                 SA_Colors,    &ScreenColors[0],
  975.                 SA_Font,    &topaz8,
  976.                 SA_Type,    CUSTOMSCREEN,
  977.                 SA_DisplayID,    monitorID|HIRES_KEY,
  978.                 SA_Pens,    &DriPens[0],
  979.                 SA_Title,    &title[0],
  980.                 TAG_DONE ))) {
  981.     puts((char *)AppStrings[MSG_ERR_OPENSCREEN].as_Str);
  982.     CloseStuff();
  983.     exit(0);
  984.   }
  985.  
  986.  
  987.  
  988.  
  989.   if (!(VisualInfo = GetVisualInfo(screen, TAG_DONE))) {
  990.     puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
  991.     CloseStuff();
  992.     exit(0);
  993.   }
  994.  
  995.  
  996.  
  997.     /* Hauptmenü erstellen */
  998.  
  999.   if (!(mainmenu = CreateMenus(MainNewMenu, GTMN_FrontPen, 0L, TAG_DONE))) {
  1000.     puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
  1001.     CloseStuff();
  1002.     exit(0);
  1003.   }
  1004.  
  1005.   LayoutMenus(mainmenu, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE);
  1006.  
  1007.  
  1008.  
  1009.     /* Menü für GAL-Prüfer erstellen */
  1010.  
  1011.   if (!(pruefermenu = CreateMenus(PrueferNewMenu, GTMN_FrontPen, 0L, TAG_DONE))) {
  1012.     puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
  1013.     CloseStuff();
  1014.     exit(0);
  1015.   }
  1016.  
  1017.   LayoutMenus(pruefermenu, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE);
  1018.  
  1019.  
  1020.  
  1021.  
  1022.   if (!(window = OpenWindowTags( NULL,
  1023.                  WA_Left,     0,
  1024.                  WA_Top,     11,
  1025.                  WA_Width,     640,
  1026.                  WA_Height,     win_height,
  1027.                  WA_IDCMP,     IDCMP_MENUHELP|IDCMP_MENUPICK|IDCMP_GADGETUP|IDCMP_RAWKEY,
  1028.                  WA_Flags,     WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_ACTIVATE,
  1029.                  WA_Title,     NULL,
  1030.                  WA_Gadgets,     &Gadget3,
  1031.                  WA_ScreenTitle, &title[0],
  1032.                  WA_CustomScreen, screen,
  1033.                  WA_MenuHelp,     TRUE,
  1034.                  TAG_DONE ))) {
  1035.     puts((char *)AppStrings[MSG_ERR_OPENWINDOW].as_Str);
  1036.     CloseStuff();
  1037.     exit(0);
  1038.   }
  1039.  
  1040.   SetMenuStrip( window, mainmenu );
  1041.   GT_RefreshWindow( window, NULL );
  1042.  
  1043.  
  1044.   myproc     = (struct Process *)FindTask(0L);        /*Requester umleiten*/
  1045.   old_ReqWin = (struct Window *)myproc->pr_WindowPtr;
  1046.   myproc->pr_WindowPtr = (APTR)window;
  1047.  
  1048. }
  1049.  
  1050.  
  1051.  
  1052.  
  1053. void CloseStuff(void)
  1054. {
  1055.  
  1056.  
  1057.   myproc->pr_WindowPtr=(APTR)old_ReqWin;  /*Req. auf ursprüngliches Window*/
  1058.  
  1059.  
  1060.   if (mainmenu) {
  1061.     ClearMenuStrip(window);
  1062.     FreeMenus(mainmenu);
  1063.   }
  1064.  
  1065.   if (pruefermenu) {
  1066.     ClearMenuStrip(window);
  1067.     FreeMenus(pruefermenu);
  1068.   }
  1069.  
  1070.  
  1071.   if ( window ) CloseWindow( window );
  1072.  
  1073.   if ( VisualInfo    ) FreeVisualInfo (VisualInfo);
  1074.   if ( filereq       ) rtFreeRequest (filereq);
  1075.   if ( screen        ) CloseScreen  (screen);
  1076.   if ( IntuitionBase ) CloseLibrary ((struct Library *)IntuitionBase);
  1077.   if ( GfxBase       ) CloseLibrary ((struct Library *)GfxBase);
  1078.   if ( ReqToolsBase  ) CloseLibrary ((struct Library *)ReqToolsBase);
  1079.  
  1080.   if ( LocaleBase    ) {
  1081.     CloseCatalog(catalog);
  1082.     CloseLibrary ((struct Library *)LocaleBase);
  1083.   }
  1084.  
  1085.   if ( GadToolsBase  ) {
  1086.     FreeGadgets(WriteGList);
  1087.     FreeGadgets(JEDGList);
  1088.     FreeGadgets(AsmGList);
  1089.     FreeGadgets(RAsm16GList);
  1090.     FreeGadgets(RAsm20GList);
  1091.     FreeGadgets(OptGList);
  1092.     FreeGadgets(SelectEditorGList);
  1093.     CloseLibrary ((struct Library *)GadToolsBase);
  1094.   }
  1095.  
  1096. }
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103. /* InitMyGadgets
  1104. ** initialisiert die GadTools-Gadgets
  1105. ** Ergebnis: 0: alles o.k., 1: Fehler
  1106. */
  1107. int InitMyGadgets(void)
  1108. {
  1109. struct    NewGadget    ng;
  1110. struct    Gadget        *g;
  1111. UWORD    lc, tc;
  1112. UWORD   offx = screen->WBorLeft, offy = screen->WBorTop + screen->RastPort.TxHeight + 1;
  1113.  
  1114.  
  1115.                     /* Gadgets für Schreibverhalten */
  1116.   if (!(g = CreateContext(&WriteGList)))
  1117.     return(1);
  1118.  
  1119.   for (lc = 0, tc = 0; lc < WriteGad_CNT; lc++) {
  1120.  
  1121.     CopyMem((char *)&WriteNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1122.  
  1123.     ng.ng_VisualInfo = VisualInfo;
  1124.     ng.ng_TextAttr   = &topaz8;
  1125.     ng.ng_LeftEdge  += offx;
  1126.     ng.ng_TopEdge   += offy;
  1127.  
  1128.     g = CreateGadgetA((ULONG)WriteGTypes[lc], g, &ng, (struct TagItem *)&WriteGTags[tc]);
  1129.  
  1130.     while (WriteGTags[tc])
  1131.       tc += 2;
  1132.     tc++;
  1133.  
  1134.     if (NOT g)
  1135.       return(1);
  1136.   }
  1137.  
  1138.  
  1139.  
  1140.                     /* Gadgets für JEDEC-Parameter */
  1141.   if (!(g = CreateContext(&JEDGList)))
  1142.     return(1);
  1143.  
  1144.   for (lc = 0, tc = 0; lc < JEDGad_CNT; lc++) {
  1145.  
  1146.     CopyMem((char *)&JEDNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1147.  
  1148.     ng.ng_VisualInfo = VisualInfo;
  1149.     ng.ng_TextAttr   = &topaz8;
  1150.     ng.ng_LeftEdge  += offx;
  1151.     ng.ng_TopEdge   += offy;
  1152.  
  1153.     g = CreateGadgetA((ULONG)JEDGTypes[lc], g, &ng, (struct TagItem *)&JEDGTags[tc]);
  1154.  
  1155.     while (JEDGTags[tc])
  1156.       tc += 2;
  1157.     tc++;
  1158.  
  1159.     if (NOT g)
  1160.       return(1);
  1161.   }
  1162.  
  1163.  
  1164.  
  1165.                     /* Gadgets für Assembler */
  1166.   if (!(g = CreateContext(&AsmGList)))
  1167.     return(1);
  1168.  
  1169.   for (lc = 0, tc = 0; lc < AsmGad_CNT; lc++) {
  1170.  
  1171.     CopyMem((char *)&AsmNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1172.  
  1173.     ng.ng_VisualInfo = VisualInfo;
  1174.     ng.ng_TextAttr   = &topaz8;
  1175.     ng.ng_LeftEdge  += offx;
  1176.     ng.ng_TopEdge   += offy;
  1177.  
  1178.     g = CreateGadgetA((ULONG)AsmGTypes[lc], g, &ng, (struct TagItem *)&AsmGTags[tc]);
  1179.  
  1180.     while (AsmGTags[tc])
  1181.       tc += 2;
  1182.     tc++;
  1183.  
  1184.     if (NOT g)
  1185.       return(1);
  1186.   }
  1187.  
  1188.  
  1189.  
  1190.                     /* Gadgets für Reassembler 16V8 */
  1191.  
  1192.   if (!(g = CreateContext(&RAsm16GList)))
  1193.     return(1);
  1194.  
  1195.   for (lc = 0, tc = 0; lc < RAsm16_CNT; lc++) {
  1196.  
  1197.      CopyMem((char *)&RAsm16NGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1198.  
  1199.      ng.ng_VisualInfo = VisualInfo;
  1200.      ng.ng_TextAttr   = &topaz8;
  1201.      ng.ng_LeftEdge  += offx;
  1202.      ng.ng_TopEdge   += offy;
  1203.  
  1204.      g = CreateGadgetA((ULONG)RAsm16GTypes[lc], g, &ng, (struct TagItem *)&RAsm16GTags[tc]);
  1205.  
  1206.      while (RAsm16GTags[tc])
  1207.        tc += 2;
  1208.      tc++;
  1209.  
  1210.      if (NOT g)
  1211.        return(1);
  1212.   }
  1213.  
  1214.                     /* Gadgets für Reasm. 20V8,22V10,20RA10 */
  1215.  
  1216.   if (!(g = CreateContext(&RAsm20GList)))
  1217.     return(1);
  1218.  
  1219.   for (lc = 0, tc = 0; lc < RAsm20_CNT; lc++) {
  1220.  
  1221.      CopyMem((char *)&RAsm20NGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1222.  
  1223.      ng.ng_VisualInfo = VisualInfo;
  1224.      ng.ng_TextAttr   = &topaz8;
  1225.      ng.ng_LeftEdge  += offx;
  1226.      ng.ng_TopEdge   += offy;
  1227.  
  1228.      g = CreateGadgetA((ULONG)RAsm20GTypes[lc], g, &ng, (struct TagItem *)&RAsm20GTags[tc]);
  1229.  
  1230.      while (RAsm20GTags[tc])
  1231.        tc += 2;
  1232.      tc++;
  1233.  
  1234.      if (NOT g)
  1235.        return(1);
  1236.   }
  1237.  
  1238.  
  1239.                     /* Gadgets für Optimizer */
  1240.  
  1241.   if (!(g = CreateContext(&OptGList)))
  1242.     return( 1L );
  1243.  
  1244.   for (lc = 0, tc = 0; lc < OptGad_CNT; lc++ ) {
  1245.  
  1246.      CopyMem((char * )&OptNGad[lc], (char * )&ng, (long)sizeof(struct NewGadget));
  1247.  
  1248.      ng.ng_VisualInfo = VisualInfo;
  1249.      ng.ng_TextAttr   = &topaz8;
  1250.      ng.ng_LeftEdge  += offx;
  1251.      ng.ng_TopEdge   += offy;
  1252.  
  1253.      g = CreateGadgetA((ULONG)OptGTypes[lc], g, &ng, (struct TagItem *)&OptGTags[tc]);
  1254.  
  1255.      while (OptGTags[tc])
  1256.        tc += 2;
  1257.      tc++;
  1258.  
  1259.      if (NOT g)
  1260.        return(1);
  1261.   }
  1262.  
  1263.  
  1264.                     /* gadgets of SelectEditor */
  1265.   if (!( g = CreateContext(&SelectEditorGList)))
  1266.     return( 1L );
  1267.  
  1268.   for (lc = 0, tc = 0; lc < SelEd_CNT; lc++ ) {
  1269.  
  1270.     CopyMem((char * )&SelectEditorNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
  1271.  
  1272.     ng.ng_VisualInfo = VisualInfo;
  1273.     ng.ng_TextAttr   = &topaz8;
  1274.     ng.ng_LeftEdge  += offx;
  1275.     ng.ng_TopEdge   += offy;
  1276.  
  1277.     SelectEditorGadgets[lc] = g = CreateGadgetA((ULONG)SelectEditorGTypes[lc], g, &ng, (struct TagItem *)&SelectEditorGTags[tc]);
  1278.  
  1279.     while (SelectEditorGTags[tc])
  1280.       tc += 2;
  1281.     tc++;
  1282.  
  1283.     if (NOT g)
  1284.       return(1);
  1285.   }
  1286.  
  1287.  
  1288.  
  1289.   return(0);
  1290.  
  1291. }
  1292.  
  1293.  
  1294.  
  1295.  
  1296.